<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%><%@ page import="csoei.bbs.Dao.TopicDao"%><%@ page import="csoei.bbs.Dao.CategoryDao"%><%@ page import="java.sql.ResultSet"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="css/frame.css" type="text/css" />
<title>
<% String cid=request.getParameter("cid");out.println(cid); %>
</title>
</head>
<body>
<div><div class="left">正在查看分类<br/><span class="catname">
<% out.print(CategoryDao.getCatnameBycid(cid)); %></span><br/>下的内容</div>
<a href="bbs.jsp">返回查看分类</a></div><div class="right"><span class="userlogin">
<% if(session.getAttribute("username")!=null)
{out.print("欢迎回来"+session.getAttribute("username")+"！&nbsp;&nbsp;<a href=\"logout\">退出登录</a>"+"<br />");}
else{out.print("<form action=\"login\" method=\"post\">"+
"<input checked=\"checked\" name=\"username\" size=\"11\" value=\"请输入用户名\" onfocus=\"if(this.value='请输入用户名')this.value=''\" onblur=\"if(this.value=='')this.value='请输入用户名'\" />"+
"<input type=\"password\" size=\"11\" name=\"password\" value=\"\" /><input type=\"submit\" value=\"点击登录\" /></form>"
);} %></span></div>
<div><% ResultSet topic=TopicDao.getTopics(cid);String tid;String title;String username;
while(topic.next()){tid=Integer.toString(topic.getInt(1));title=topic.getString(2);username=topic.getString(3);
out.println("<div class=\"topic\"><a href=\"topic.jsp?tid="+tid+"\">"+title+"</a></div>");
}
%></div>
<%if(session.getAttribute("username")!=null){out.println("<div>发表新标题</div><form action=\"newtopic\" method=\"post\" target=\"_self\">"
		+"<input type=\"text\" value=\""+session.getAttribute("username")+"\" name=\"username\" /><br /><input type=\"text\" name=\"title\"  value=\"请输入标题\"/><br />"
+"	内容：<br /><textarea name=\"content\"></textarea><br /><input type=\"hidden\" name=\"cid\" value=\""+cid+"\" /><input type=\"submit\" /></form>");} %>

</body>
</html>
